package com.scy.java.object.stad;

import java.time.LocalDate;

//账户类：账号，密码，余额。
public class Accound {
    private int id;
    private String pwd;
    private double balance;//余额
    private static double rate;//利率
    private static double minBalance=12.0;//最小余额
    //自动生成账号。
    private static Integer init=Integer
            .valueOf((LocalDate.now()+"")
            .replace("-",""));
    public Accound() {
        this.id =init;
        init++;
        pwd="80231314";
        balance=(Math.random()*100000+1);
    }
//    //静态代码块。
//    static {
//
//    }
    //静态代码块先加载（按顺序执行，只执行一次）。
//static {
//        minBalance=3.9;
//  }
//  //非静代码块态后加载
//    {
//        pwd="21241";
//        System.out.println("我是你爹");
//    }

    public Accound(Integer id, String pwd, double balance) {
        this.id = id;
        this.pwd = pwd;
        this.balance = balance;
    }

    @Override
    public String toString() {
        return "Accound{" +
                "id=" + id +
                ", pwd='" + pwd + '\'' +
                ", balance=" + balance +
                '}';
    }
    public int getId() {
        return id;
    }

    public void setId(int id) {
        this.id = id;
    }

    public String getPwd() {
        return pwd;
    }

    public void setPwd(String pwd) {
        this.pwd = pwd;
    }

    public double getBalance() {
        return balance;
    }

    public void setBalance(double balance) {
        this.balance = balance;
    }

    public static double getRate() {
        return rate;
    }

    public static void setRate(double rate) {
        Accound.rate = rate;
    }

    public static double getMinBalance() {
        return minBalance;
    }

    public static void setMinBalance(double minBalance) {
        Accound.minBalance = minBalance;
    }

}
